Device address locking to facilitate optimum usage of the industry standard IIC bus

ABSTRACT

A mechanism is provided for locking an end device for the period of time that the device is needed, thus disabling access by any other application or process. Having the device locked, rather than the bus, allows other applications to use the bus to access other devices at the same time. This is achieved by providing a virtual bus arbitration, which arbitrates applications&#39; use of the physical bus. The virtual bus arbitration algorithms allow bus operations from different applications to overlap on the physical bus as long as their target devices and associated bus locks are on different end devices.

BACKGROUND OF THE INVENTION

1. Technical Field

The present invention relates to data processing systems and, inparticular, to bus usage and arbitration in a data processing system.Still more particularly, the present invention provides a method,apparatus, and program for locking device addresses to facilitateoptimum usage of an inter-integrated circuit bus.

2. Description of Related Art

A bus is a common pathway, or channel, between multiple devices. Thecomputer's internal bus is known as the local bus, or processor bus.This type of bus provides a parallel data transfer path between the CPUand main memory and to the peripheral buses. A 16-bit bus transfers twobytes at a time over 16 wires. Likewise, a 32-bit bus uses 32 wires totransfer four bytes of data at a time. The bus is comprised of twoparts: the address bus and the data bus. Addresses are sent over theaddress bus to signal a memory location, and the data is transferredover the data bus to that location.

Various other types of buses are used in data processing systems. Inparticular, an Inter-Integrated Circuit (IIC) bus is an example ofanother type of bus used in a data processing system. An IIC bus, alsoreferred to as an I²C bus, was developed by Koninklijke PhilipsElectronics NV, also known as Philips Semiconductors. Details andspecifications on the protocols for this bus are found in The I²C-BusSpecification, Version 2.1, January 2000. In this bus, one wire carriesa clock signal, while another wire carries the data signal. This type ofbus is used to provide interconnection between various devices, such asa flexible service processor (FSP), a memory, and a control panel. Aflexible service processor is a processing unit that is used toinitialize a data processing system. A FSP has its own boot code andoperating system and may be connected to a number of input/output (I/O)devices.

In a complex embedded systems environment, a single IIC bus has severalslave devices attached and multiple applications communicate withmultiple end devices. In some cases, an application must access a deviceon the bus for a defined and continuous period of time. This may beachieved by placing a device soft lock on the bus usage or guarding theusage of the bus through a semaphore, until the application frees up thebus after transfer is complete.

One example of such a usage scenario is vital product data (VPD)collection or update on Squadrons. For read operations, the VPDapplication needs to access the Squadron electrically erasableprogrammable read only memory (SEEPROM), which in some cases may be ofbigger memory size than the memory buffer size of the IIC controllerhardware on the FSP cards. In such cases, the application needs to lockthe bus until it reads all data on the SEEPROM chips, so that no otherapplication can disrupt the operation by trying to access the samedevice on the same bus.

In the case of write operations, the VPD application may attempt towrite, for example, 256 bytes. The memory chips may have an eight bytepage write support. At the end of each page write, the end device goesinto a write cycle (maximum 10 ms). The 256 byte write needs to bebroken up into 32 eight-byte writes. After each of these 32 IIC writeoperations, there may be 10 ms idle bus time. The bus is locked by onesuch process even though there is idle bus time during the lock period,when other applications could possibly be using the bus to access otherdevices on the same bus.

Thus, the current arbitration mechanism of locking the bus creates aproblem of bus hogging by one process. All other applications must waituntil the application that has the lock frees the bus. Therefore, itwould be advantageous to have an improved method, apparatus, and programinstructions for device address locking to facilitate optimum usage ofan inter-integrated circuit bus.

SUMMARY OF THE INVENTION

The present invention provides a mechanism for locking an end device forthe period of time that the device is needed, thus disabling access byany other application or process. Having the device locked, rather thanthe bus, allows other applications to use the bus to access otherdevices at the same time. This is achieved in the present invention byproviding a virtual bus arbitration, which arbitrates applications' useof the physical bus. The virtual bus arbitration algorithms allow busoperations from different applications to overlap on the physical bus aslong as their target devices and associated bus locks are on differentend devices.

BRIEF DESCRIPTION OF THE DRAWINGS

The novel features believed characteristic of the invention are setforth in the appended claims. The invention itself, however, as well asa preferred mode of use, further objectives and advantages thereof, willbest be understood by reference to the following detailed description ofan illustrative embodiment when read in conjunction with theaccompanying drawings, wherein:

FIG. 1 is a pictorial representation of a data processing system inwhich the present invention may be implemented in accordance with apreferred embodiment of the present invention;

FIG. 2 is a block diagram of a data processing system in which thepresent invention may be implemented;

FIG. 3 is a diagram illustrating physical devices used in transferringdata in accordance with a preferred embodiment of the present invention;

FIG. 4 is a block diagram depicting layers of abstraction in aninter-integrated circuit bus environment in accordance with a preferredembodiment of the present invention; and

FIG. 5 is a flowchart illustrating the operation of a virtualarbitration mechanism in accordance with a preferred embodiment of thepresent invention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT

With reference now to the figures and in particular with reference toFIG. 1, a pictorial representation of a data processing system in whichthe present invention may be implemented is depicted in accordance witha preferred embodiment of the present invention. A computer 100 isdepicted which includes system unit 102, video display terminal 104,keyboard 106, storage devices 108, which may include floppy drives andother types of permanent and removable storage media, and mouse 110.Additional input devices may be included with personal computer 100,such as, for example, a joystick, touchpad, touch screen, trackball,microphone, and the like.

Computer 100 can be implemented using any suitable computer, such as anIBM eServer computer or IntelliStation computer, which are products ofInternational Business Machines Corporation, located in Armonk, N.Y.Although the depicted representation shows a computer, other embodimentsof the present invention may be implemented in other types of dataprocessing systems, such as a network computer. Computer 100 alsopreferably includes a graphical user interface (GUI) that may beimplemented by means of systems software residing in computer readablemedia in operation within computer 100.

With reference now to FIG. 2, a block diagram of a data processingsystem is shown in which the present invention may be implemented. Dataprocessing system 200 is an example of a computer, such as computer 100in FIG. 1, in which code or instructions implementing the processes ofthe present invention may be located. Data processing system 200 employsa peripheral component interconnect (PCI) local bus architecture.Although the depicted example employs a PCI bus, other bus architecturessuch as Accelerated Graphics Port (AGP) and Industry StandardArchitecture (ISA) may be used. Processor 202 and main memory 204 areconnected to PCI local bus 206 through PCI bridge 208. PCI bridge 208also may include an integrated memory controller and cache memory forprocessor 202. Additional connections to PCI local bus 206 may be madethrough direct component interconnection or through add-in boards.

In the depicted example, local area network (LAN) adapter 210, smallcomputer system interface SCSI host bus adapter 212 and flexible serviceprocessors 214 are connected to PCI local bus 206 by direct componentconnection. In contrast, audio adapter 216, graphics adapter 218, andaudio/video adapter 219 are connected to PCI local bus 206 by add-inboards inserted into expansion slots. Flexible service processors 214provide PCI and IIC bus connections. In this example, flexible serviceprocessors 214 are connected to inter-internal control physical devices215 by IIC bus 217. Inter-internal control physical devices 214 includescomponents, such as a control panel, a flexible service processor, apower device, and a memory.

SCSI host bus adapter 212 provides a connection for hard disk drive 226,tape drive 228, and CD-ROM drive 230. Typical PCI local busimplementations will support three or four PCI expansion slots or add-inconnectors.

An operating system runs on processor 202 and is used to coordinate andprovide control of various components within data processing system 200in FIG. 2. The operating system may be a commercially availableoperating system such as Windows XP, which is available from MicrosoftCorporation. Instructions for the operating system and applications orprograms are located on storage devices, such as hard disk drive 226,and may be loaded into main memory 204 for execution by processor 202.

Those of ordinary skill in the art will appreciate that the hardware inFIG. 2 may vary depending on the implementation. Other internal hardwareor peripheral devices, such as flash read-only memory (ROM), equivalentnonvolatile memory, or optical disk drives and the like, may be used inaddition to or in place of the hardware depicted in FIG. 2. Also, theprocesses of the present invention may be applied to a multiprocessordata processing system.

For example, data processing system 200, if optionally configured as anetwork computer, may not include SCSI host bus adapter 212, hard diskdrive 226, tape drive 228, and CD-ROM 230. In that case, the computer,to be properly called a client computer, includes some type of networkcommunication interface, such as LAN adapter 210, modem 222, or thelike. As another example, data processing system 200 may be astand-alone system configured to be bootable without relying on sometype of network communication interface, whether or not data processingsystem 200 comprises some type of network communication interface. As afurther example, data processing system 200 may be a personal digitalassistant (PDA), which is configured with ROM and/or flash ROM toprovide non-volatile memory for storing operating system files and/oruser-generated data.

The depicted example in FIG. 2 and above-described examples are notmeant to imply architectural limitations. For example, data processingsystem 200 also may be a notebook computer or hand held computer inaddition to taking the form of a PDA. Data processing system 200 alsomay be a kiosk or a Web appliance.

Turning next to FIG. 3, a diagram illustrating physical devices used intransferring data is depicted in accordance with a preferred embodimentof the present invention. The physical devices illustrated in FIG. 3 aresimilar to IIC physical devices 214 in FIG. 2.

In this example, flexible service processor (FSP) 300, rack powercontroller (RPC) 302, thermal unit 304, memory 306, panel 308, rackpower controller 310, and memory 312 are connected to a primary IIC bus,which is formed by data line 314 and clock line 316. IIC hub 318 is alsoconnected to data line 314 and clock line 316. This hub provides aninterconnection for two additional IIC buses formed by data line 320,clock line 322, data line 324, and clock line 326 in this example.Memory 328 and memory 330 are connected to data line 320 and clock line322. Memory 332 and memory 334 are connected to data line 324 and clockline 326.

As illustrated, flexible service processor 300 is a physical device thatexecutes an operating system and is initialized prior to initializingthe rest of the data processing system. Flexible service processor 300includes components, such as nonvolatile memory, dynamic random accessmemory, a flash memory, and a controller to control various I/O devices.Rack power controller 302 and 310 are physical devices that providecontrol functions for power to a data processing system. Thermal unit304 is a physical device providing temperature data. Panel 308 is aphysical device, such as a panel with a power or reset button. Memory306, memory 312, memory 328, memory 330, memory 332, and memory 334 areused to store data.

In this example, flexible service processor 300 acts as either a slaveor master device in which a number of applications may execute. Panel308, rack power controller 302, and rack power controller 310 may act aseither slave or master devices. The memories illustrated are normallyslave devices as well as thermal unit 304. IIC hub 318 is a master onlyfor the sub-buses formed by data line 320, clock line 322, data line324, and clock line 326. This hub is a slave on the primary bus formedby data line 314 and clock line 316.

The protocol for IIC buses supports I/O reads and writes in twodifferent modes. One mode involves an I/O operation issued by a master,which is referred to as a master read/write. A second mode for I/Ooperations is a slave read/write, which is triggered by devices externalto the system in consideration. In this example, the system inconsideration may be flexible service processor 300, with externaldevices, such as rack power controller 302 and panel 308 triggering theslave I/O operations. Flexible service processor 300 is an embeddedsystem, which includes applications having responsibility for physicaldevices attached to the IIC buses. Such a function requires flexibleservice processor 300 to operate as a slave.

With reference now to FIG. 4, a block diagram depicts layers ofabstraction in an inter-integrated circuit bus environment in accordancewith a preferred embodiment of the present invention. Applicationswithin application layer 402 communicate with the bus through devicedriver layer 410. The device driver layer 410 includes device drivers414, which interacts directly with the target hardware and sets thehardware up for access.

Applications wishing to communicate with devices on the IIC hardware,including, for example, blackwidow base IIC 422 and blackwidow extenderIIC 424, send requests through the device driver layer to probe for theparticular end device on the bus. Blackwidow base and blackwidowextender are different chips pertaining to different hardware. Thesechips represent examples of hardware existing at the hardware level. Therequests are sent through abstract wrapper layer 412 to device drivers414. The abstract wrapper layer provides a wrapper to the device driverinterfaces for the applications that need to use the hardware services.

Abstract wrapper layer 412 determines whether the device is available.If the device is available, the abstract wrapper layer places a lock onthe device address, restricting its use by any other application. In themeantime, other applications that request access to any other device onthe same bus can request a lock on that device. The device driver layerkeeps a list 413 of occupied end device addresses and is responsible forlocking the resources when transfers are ongoing and for releasingresources when transfers are complete.

Turning now to FIG. 5, a flowchart illustrating the operation of avirtual arbitration mechanism, such as abstract wrapper layer 412 inFIG. 4, is shown in accordance with a preferred embodiment of thepresent invention. The process begins and a determination is made as towhether an exit condition exists (step 502). An exit condition mayexist, for example, when the data processing system shuts down or whenthe IIC bus fails or is taken off-line.

If an exit condition exists in step 502, the process ends; otherwise, adetermination is made as to whether a request for access is received(step 504). A request for access preferably includes a device addressfor an end device on the IIC bus. If a request for access is received, adetermination is made as to whether the device is locked (step 506). Ifthe device is locked, the process denies access to the device (step508). Then, the process returns to step 502 to determine whether an exitcondition exists.

If the device is not locked in step 506, the process locks the enddevice (step 510) and places the device address in the list of occupiedend device addresses (step 512). Thereafter, the process performs thedevice access operation (step 514) and returns to step 502 to determinewhether an exit condition exists.

If a request is not received in step 504, a determination is made as towhether a transfer is completed. (step 516). If a transfer is notcompleted, the process returns to step 502 to determine whether an exitcondition exists. If, however, a transfer is completed in step 516, theprocess unlocks the end device (step 518) and removes the device addressfrom the list of occupied end devices (step 520). Then, the processreturns to step 502 to determine whether an exit condition exists.

Thus, the present invention solves the disadvantages of the prior art byproviding a mechanism for locking device addresses to optimize bus usageof the underlying hardware. The present invention eliminates bushogging, meaning that while an application is performing a transfer toor from an end device on a bus, another application may access anothersuch device on the same bus.

Furthermore, the mechanism of the present invention checks any busmalfunctions. If a processor is using the bus and hangs for some reason,another process can still get through the layers of software abstractionand probe the bus lines to determine the reason for the malfunction ofthe bus without depending upon the hardware probe/recovery mechanisms.The present invention can be further extended and utilized to keep acheck on the number of devices that are being used currently on the busand provide a method to control the bus traffic.

While the above examples are directed to an IIC bus, the presentinvention may also apply to other bus architectures. The emphasis of thepresent invention is on placing a lock on an end device, rather than thebus itself, in such a manner that chained activity on the bus is notrestricted to only one end device at a time. Through the mechanism ofthe present invention, multiple applications can overlap activity on thebus even though certain device activity must be chained.

It is important to note that while the present invention has beendescribed in the context of a fully functioning data processing system,those of ordinary skill in the art will appreciate that the processes ofthe present invention are capable of being distributed in the form of acomputer readable medium of instructions and a variety of forms and thatthe present invention applies equally regardless of the particular typeof signal bearing media actually used to carry out the distribution.Examples of computer readable media include recordable-type media, suchas a floppy disk, a hard disk drive, a RAM, CD-ROMS, DVD-ROMs, andtransmission-type media, such as digital and analog communicationslinks, wired or wireless communications links using transmission forms,such as, for example, radio frequency and light wave transmissions. Thecomputer readable media may take the form of coded formats that aredecoded for actual use in a particular data processing system.

The description of the present invention has been presented for purposesof illustration and description, and is not intended to be exhaustive orlimited to the invention in the form disclosed. Many modifications andvariations will be apparent to those of ordinary skill in the art. Theembodiment was chosen and described in order to best explain theprinciples of the invention, the practical application, and to enableothers of ordinary skill in the art to understand the invention forvarious embodiments with various modifications as are suited to theparticular use contemplated.

1. A method for performing bus arbitration, the method comprising:receiving a request to perform a device access operation on an enddevice on a bus; determining whether the end device is locked; andresponsive to the end device not being locked, locking the end deviceand performing the device access operation.
 2. The method of claim 1,wherein the device access operation is one of a read operation and awrite operation.
 3. The method of claim 1, further comprising:responsive to the end device being locked, denying the device accessoperation.
 4. The method of claim 1, wherein the step of determiningwhether the end device is locked includes determining whether an addressof the end device is found in a list of occupied end devices.
 5. Themethod of claim 1, wherein the step of locking the end device includesplacing a device address of the end device in a list of occupied enddevices.
 6. The method of claim 5, further comprising: responsive to thedevice access operation completing, unlocking the end device.
 7. Themethod of claim 6, wherein the step of unlocking the end device includesremoving the device address from the list of occupied end devices.
 8. Anapparatus for performing bus arbitration, the apparatus comprising:means for receiving a request to perform a device access operation on anend device on a bus; means for determining whether the end device islocked; and means, responsive to the end device not being locked, forlocking the end device and performing the device access operation. 9.The apparatus of claim 8, wherein the device access operation is one ofa read operation and a write operation.
 10. The apparatus of claim 8,further comprising: means, responsive to the end device being locked,for denying the device access operation.
 11. The apparatus of claim 8,wherein the means for determining whether the end device is lockedincludes means for determining whether an address of the end device isfound in a list of occupied end devices.
 12. The apparatus of claim 8,wherein the means for locking the end device includes means for placinga device address of the end device in a list of occupied end devices.13. The apparatus of claim 12, further comprising: means, responsive tothe device access operation completing, for unlocking the end device.14. The apparatus of claim 13, wherein the means for unlocking the enddevice includes means for removing the device address from the list ofoccupied end devices.
 15. An apparatus for performing bus arbitration,the apparatus comprising: a bus; at least one end device connected tothe bus; an application; and a driver layer, wherein the driver layerincludes at least one device driver that communicates with the at leastone end device and a wrapper layer, wherein the wrapper layer receives arequest to perform a device access operation on an end device fromwithin the at least one end device on the bus, determines whether theend device is locked, and, responsive to the end device not beinglocked, locks the end device and performs the device access operation.16. A computer program product, in a computer readable medium, forperforming bus arbitration, the computer program product comprising:instructions for receiving a request to perform a device accessoperation on an end device on a bus; instructions for determiningwhether the end device is locked; and instructions, responsive to theend device not being locked, for locking the end device and performingthe device access operation.
 17. The computer program product of claim16, wherein the instructions for determining whether the end device islocked include instructions for determining whether an address of theend device is found in a list of occupied end devices.
 18. The computerprogram product of claim 16, wherein the instructions for locking theend device include instructions for placing a device address of the enddevice in a list of occupied end devices.
 19. The computer programproduct of claim 18, further comprising: instructions, responsive to thedevice access operation completing, for unlocking the end device. 20.The computer program product of claim 19, wherein the instructions forunlocking the end device include instructions for removing the deviceaddress from the list of occupied end devices.